<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="Head.jsp" %>
<title>Post</title>
</head>

<body>

<%-- Header --%>
<%@ include file="Header.jsp" %>

<script type="text/javascript" src="post_utils.js"></script>

<h1>U WAN TU POS CIZBURGER?</h1>

<%-- Display errors --%>
<c:if test="${not empty errors}">
  <p class="error">
  ${errors}
  </p>
</c:if>

<form action="PostSubmit" method="post" enctype="multipart/form-data">
<ul>
  <li>Title: <input type="text" name="title" value="${title}"/></li>
  <li>
    <ul>
      <li><input type="radio" name="type" id="link_radio" value="link" onclick="RefreshPostForm()"/>Link</li>
      <li>
        <ul>
	        <li>URL : <input type="text" name="link_url" id="link_url" disabled value="${link_url}"/></li>
		      <li>
		        Description :<br/>
		        <textarea name="description" id="description" rows="5" cols="50" disabled>${description}</textarea>
		      </li>
		    </ul>
	    </li>
    </ul>
    <ul>
      <li><input type="radio" name="type" id="image_radio" value="image" onclick="RefreshPostForm()"/>Image</li>
      <li>
	      <ul>
	        <li>Image : <input type="file" name="image" id="image" disabled/></li>
        </ul>
      </li>
    </ul>
    <ul>
      <li><input type="radio" name="type" id="video_radio" value="video" onclick="RefreshPostForm()"/>Video</li>
      <li>
        <ul>
          <li>Youtube Link : <input type="text" name="video_url" id="video_url"
                              disabled value="${video_url}" onblur="YoutubeVideoChange()"
                              onchange="YoutubeVideoChange()"/></li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Tag: <input type="text" name="tag" value="${tag}"/></li>
</ul>
<input type="hidden" name="video_url_parsed" id="video_url_parsed" value="${video_url_parsed}"/>
<input type="submit" value="Post" id="post_button" disabled/>
</form>
<button id="preview_button" onclick="Preview()" disabled>Preview</button>

<ul id="content_list">
</ul>

<script type="text/javascript">
  RefreshPostForm('${content.id}', '${sessionScope.username}');
</script>

</body>
</html>